package Textbookmanagement;

import java.util.regex.*;
import java.util.Scanner;

public class Order {
    Scanner sc = new Scanner(System.in);
    public static String num;
    public static String nameprice;

    public void show() {
        System.out.println("1.订购信息登记     2.订购信息查询");
        System.out.println("                 0.退出");
        System.out.println("请输入功能：");

    }

    public void InformationRegistration() {//正则表达式判断有几本书
        System.out.println("输入预定书籍的名称和价格：");
        nameprice = sc.nextLine();
        System.out.println("请输入库位号：");
        num = sc.next();
    }

    private void part(String nameprice) {
        Pattern p = Pattern.compile("[a-zA-Z\\u4e00-\\u9fa5]+");
        Pattern a = Pattern.compile("\\d+");
        Matcher m = p.matcher(nameprice);
        Matcher t = a.matcher(nameprice);
        while (m.find()) {
            System.out.print("《" + m.group() + "》" + '\t' + '\t');
        }
        System.out.println(" ");
        while (t.find()) {
            System.out.print(t.group() + "元" + '\t' + '\t');
        }
        System.out.println(" ");
        System.out.println("库位号：" + num);

    }

    public void InformationInquiry() {
        System.out.println("预定书籍信息如下：");
        part(nameprice);


    }
}
